package com.piper.provider.service;

import com.xiaoleilu.hutool.date.DateUtil;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

@Component
@CacheConfig(cacheNames = "user")
public class RedisCacheService {

    @CachePut(key = "#key")
    public String put(String key) {
        return key + DateUtil.now();
    }

    @Cacheable(key = "#p0")
    public String get(String key) {
        return key + DateUtil.now();
    }

    @CacheEvict(key = "#p0")
    public void del(String key) {
    }
}
